import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/admin/Login.vue'

Vue.use(VueRouter)

const routes = [
	{
		path: '/',
		redirect: '/login'
	},
	{
		path: '/login',
		name: 'Login',
		component: Login
	},
	{
		path: '/blogs',
		name: 'Blogs',
		component: () => import('../views/blogs/Blogs.vue')
	},
	{
		path: '/detail/:blogsId',
		name: 'BlogsDetail',
		component: () => import('../views/blogs/BlogsDetail.vue')
	},
	{
		path: '/layout',
		name: 'Layout',
		component: () => import('../views/admin/Layout.vue'),
		redirect: '/home',
		children: [
			{
				path: '/home',
				name: 'Home',
				component: () => import('../views/admin/Home.vue')
			},
			{
				path: '/imgList',
				name: 'ImgList',
				component: () => import('../views/admin/ImageList.vue')
			}
		]
	}
]

const router = new VueRouter({
	mode: 'history',
	base: process.env.BASE_URL,
	routes
})

export default router
